home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS03.ADF / C / cr2lf.c < prev    next >
C/C++ Source or Header  |  1986-04-02  |  367b  |  27 lines

  1.  
  2. /* This filter changes CR to LF.
  3.  
  4.  * If you 'type' a file, and it all appears on one line,
  5.  * it has only CR (carriage returns), and needs LFs instead.
  6.  *
  7.  * Usage:
  8.  * cr2lf < infile > outfile
  9.  *
  10.  * By John Foust
  11.  */
  12.  
  13. #include "stdio.h"
  14.  
  15. main()
  16. {
  17. int c;
  18.  
  19.    while ((c=getchar())!=EOF) {
  20.       if (c==13)
  21.          putchar(10);
  22.       else
  23.          putchar(c);
  24.    }
  25. }
  26.  
  27.